------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[

    调试用的用电器

]]--
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---
    local assets =
    {
        Asset("ANIM", "anim/cane.zip"),
        Asset("ANIM", "anim/swap_cane.zip"),
    }
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- 
    local function fn()
        local inst = CreateEntity()

        inst.entity:AddTransform()
        inst.entity:AddAnimState()
        inst.entity:AddSoundEmitter()
        inst.entity:AddNetwork()

        inst.AnimState:SetBank("cane")
        inst.AnimState:SetBuild("swap_cane")
        inst.AnimState:PlayAnimation("idle")

        inst.entity:SetPristine()

        if not TheWorld.ismastersim then
            return inst
        end

        inst:AddComponent("inspectable")
        inst:AddComponent("loramia_com_power_device")



        MakeHauntableLaunch(inst)
        return inst
    end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- item
    local function item_fn()
        local inst = CreateEntity()

        inst.entity:AddTransform()
        inst.entity:AddAnimState()
        inst.entity:AddSoundEmitter()
        inst.entity:AddNetwork()

        MakeInventoryPhysics(inst)

        inst.AnimState:SetBank("cane")
        inst.AnimState:SetBuild("swap_cane")
        inst.AnimState:PlayAnimation("idle")

        MakeInventoryFloatable(inst)
        inst.entity:SetPristine()

        if not TheWorld.ismastersim then
            return inst
        end
        inst:AddComponent("inspectable")
        inst:AddComponent("inventoryitem")
        inst.components.inventoryitem:ChangeImageName("cane")
        MakeHauntableLaunch(inst)
        ---------------------------------------------------------------------------
        ---
            inst:AddComponent("deployable")
            inst.components.deployable.ondeploy = function(inst, pt, deployer)
                inst:Remove()
                SpawnPrefab("loramia_debug_power_device").Transform:SetPosition(pt.x,0,pt.z)
            end
            -- inst.components.deployable:SetDeployMode(DEPLOYMODE.PLANT)
            inst.components.deployable:SetDeploySpacing(DEPLOYSPACING.NONE)
        ---------------------------------------------------------------------------
        return inst
    end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---
    local function placer_postinit_fn(inst)
        TheWorld:PushEvent("loramia_com_power_battery_indicator_active",inst)
    end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



return Prefab("loramia_debug_power_device", fn, assets),
    Prefab("loramia_debug_power_device_kit", item_fn, assets),
    MakePlacer("loramia_debug_power_device_kit_placer", "cane", "swap_cane", "idle", nil, nil, nil, nil, nil, nil, placer_postinit_fn, nil, nil)

